public class Zifuchuan_14 {
    public static String solution(String[] strs){
        if (strs == null || strs.length == 0  ) {
            return "";
        }
        for (int i = 0; i <strs.length ; i++) {
            if(strs[i].isEmpty()){
                return "";
            }
        }
        int n = strs.length;
        int tem = 0;
        //求最小的字符串的长度
        for (int i = 1; i < strs.length; i++) {
            int a = strs[i].length();
            n=Math.min(n,a);
        }
        for (int i = 0; i <n ; i++) {
            int count = 0;
            char c = strs[0].charAt(i);
            for (int j = 1; j < strs.length ; j++) {
                if (c == strs[j].charAt(i)) {
                    count++;
                }
            }
            if(count== strs.length-1){
                tem++;
            }
            else {
                break;
            }
        }
        String s = "";
        for (int i = 0; i < tem; i++) {
            s=s+strs[0].charAt(i);
        }
        return s;
    }
    public static void main(String[] args) {
        String[] strs ={""};
        System.out.println(solution(strs));

        }

    }

